<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>

<script type="text/javascript">
    var rowId = 0;
    
    $('.ui-reset , #refresh_appraisalGrid').click(function(){
        $("#appraisalGrid").jqGrid('setGridParam',{search:false});
        var postData = $("#appraisalGrid").jqGrid('getGridParam','postData');
        $.extend(postData,{searchField:"",searchString:"",searchOper:""});
        $.extend(postData,{filters:""});
        $("#appraisalGrid").trigger("reloadGrid");
    });

    $.subscribe('searchAppraisalGrid', function(event,data) {
        $("#appraisalGrid").jqGrid('searchGrid', {drag:true,closeAfterSearch:true,closeOnEscape:true,sopt:['eq'],caption:"Search Appraisal"} );
    });
    
    $.subscribe('appraisalGridComplete',function(event,data){
        $( "#appraisalGrid_search" ).button( "option", "disabled", false );
    });
    
</script>
<div class="gridOptsContainer">
    <sj:submit button="true" cssStyle="font-size:14px;" disabled="true" id="appraisalGrid_search" onClickTopics="searchAppraisalGrid" value="Search Appraisal"/>
</div>
<s:url id="remoteurl" action="grid-appraisal"/>
<sjg:grid
    id="appraisalGrid"
    caption="Cashmate Appraisals"
    dataType="json"
    href="%{remoteurl}"
    gridModel="gridModel"
    pager="true"
    pagerButtons="true"
    pagerInput="true"
    rowList="15,30,50"
    rowNum="15"
    loadingText="Requesting Data..."
    width="970"
    shrinkToFit="true"
    hoverrows="true"
    rownumbers="true"
    autoencode="true"
    viewrecords="true"
    navigator="true"
    navigatorAdd="false"
    navigatorDelete="false"
    navigatorEdit="false"
    navigatorSearch="true"
    navigatorView="true"
    onGridCompleteTopics="appraisalGridComplete"
    >

    <sjg:gridColumn name="appraisalid"
                    key="true"
                    index="appraisalid"
                    title="appraisalid. (Not Editable)"
                    sortable="false"
                    hidden="true"
                    align="center"
                    />

    <sjg:gridColumn name="documentno"
                    index="documentno"
                    title="Document No."
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />

    <sjg:gridColumn name="idnumber"
                    index="idnumber"
                    title="Employee"
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />

    <sjg:gridColumn name="loanappdocumentno"
                    index="loanappdocumentno"
                    title="Loan Application Document"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    sortable="true"
                    align="center"
                    />

    <sjg:gridColumn name="accountno"
                    index="accountno"
                    title="Account No."
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />

    <sjg:gridColumn name="dateoffirstrelease"
                    index="dateoffirstrelease"
                    title="Date of First Release"
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />

    <sjg:gridColumn name="totalfairmarketvalue"
                    index="totalfairmarketvalue"
                    title="Total Fair Market Value"
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />

    <sjg:gridColumn name="totalappraisedvalue"
                    index="totalappraisedvalue"
                    title="Total Appraised Value"
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />

    <sjg:gridColumn name="loanableamount"
                    index="loanableamount"
                    title="Loanable Amount"
                    sortable="true"
                    search="true"
                    searchoptions="{sopt:['eq']}"
                    align="center"
                    />
</sjg:grid>
